package com.zjm.behavioral.memento.theory;

public class Originator {

    //状态信息
    private String state;

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    /**
     * 保存状态对象Memento
     *
     * @return
     */
    public Memento saveStateMemento() {
        return new Memento(state);
    }

    /**
     * 通过备忘录对象恢复状态
     */
    public void getStateFromMemento(Memento memento){
        state = memento.getState();
    }
}
